<script setup>
export default {
  data() {
    return {
      images: [
        { url: require('@/assets/images/saohei.jpg'), alt: 'Image1' },
        {  url: require('@/assets/images/laifu.jpg'), alt: 'Image2' },
        { url: require('@/assets/images/wocai.jpg'), alt: 'Image3' },
        { url: 'https://example.com/image4.jpg', alt: 'Image 4' },
        { url: 'https://example.com/image5.jpg', alt: 'Image 5' },
        { url: 'https://example.com/image6.jpg', alt: 'Image 6' }
      ]
    };
  }
}

</script>

<template>
  <el-carousel :interval="5000" type="card" height="400px">
    <el-carousel-item v-for="(image, index) in images" :key="index">
      <div>
        <img :src="image.url" :alt="image.alt" class="custom-image">
      </div>
    </el-carousel-item>
  </el-carousel>
</template>

<style scoped lang="scss">
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
  .custom-image {
    width: 100%; /* 设置图片宽度 */
    height: 300px; /* 高度自适应保持比例 */
  }
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}
</style>
